// 格式化时间 00:00
let filterTime =  function(value){
  var m =  Math.floor((value/1000)/60);
  var s = Math.floor((value/1000)%60);

  if(m<10){
    m = "0"+m;
  }
  if(s<10){
    s = "0"+s;
  }

  return `${m}:${s}`;
};


// 格式化数字,为不足10的数字前面添加0
let filterNumber = function(num){
	num<10?num="0"+num:num=num;
	return num;
}


// 格式化播放量, 超过万, 后面以"万"显示
let filterPlayCount = function(num){
  num = Math.floor(num/10000)+"万"
  return num;
}


// 将毫秒数转化成"xxx年xx月xx日"
let filterDate = function(num){
  var mydate = new Date(num),
      myyear = mydate.getFullYear(),
      mymonth = mydate.getMonth()+1,
      myday = mydate.getDate();

  if(mymonth<10){
    mymonth = "0"+mymonth;
  }
  if(myday<10){
    myday = "0"+myday;
  }

  return `${myyear}-${mymonth}-${myday}`;
}



// 要导出
export{
  filterTime,
  filterNumber,
  filterPlayCount,
  filterDate
}
